﻿using System;

using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Silvermoon.Windows;

namespace Silvermoon.Controls
{
    public abstract class ListViewControllerBase<C> : SimpleListViewController<C> where C : Item
    {
        public ListViewControllerBase(ListView listView)
            : base(listView)
        {
            this.ItemHeight = 80;
        }

        public override void Dispose()
        {
            base.Dispose();
            DisposeStyles();
        }

        public StyleBase GroupStyle { get; set; }

        /// <summary>
        /// Gets or sets the style used to attach to the header button of an item group which is used to open the group picker.
        /// </summary>
        public StyleBase GroupButtonStyle { get; set; }

        /// <summary>
        /// Gets or sets the style which is attached to the tile to select a group.
        /// </summary>
        public StyleBase GroupPickerStyle { get; set; }

        /// <summary>
        /// Gets or set the style for the window that shows the selectable groups to choose.
        /// </summary>
        public StyleBase GroupPickerWindowStyle { get; set; }

        /// <summary>
        /// Gets or sets the height for virtualized items.
        /// </summary>
        public int ItemHeight { get; set; }

        /// <summary>
        /// Gets or sets the size for group buttons in the list which opens the group picker.
        /// </summary>
        public Size GroupButtonSize { get; set; }

        /// <summary>
        /// Gets or sets the size for a group tile in the group picker.
        /// </summary>
        public Size PickerTileSize { get; set; }



        private void DisposeStyles()
        {
            DisposeIfNotNull(GroupStyle);
            DisposeIfNotNull(GroupPickerStyle);
            DisposeIfNotNull(GroupButtonStyle);
            DisposeIfNotNull(GroupPickerWindowStyle);
        }

    }
}
